package com.example.mobile2021606127cxz0507;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity3 extends AppCompatActivity {

    private TextView tvMainSupplier;
    private Button btnMainSelect;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);
        initView();
    }

    private void initView() {
        tvMainSupplier = (TextView) findViewById(R.id.tv_main_supplier);
        btnMainSelect = (Button) findViewById(R.id.btn_main_select);
    }

    public void select(View view) {
        Intent intent = new Intent(MainActivity3.this, MainActivity4.class);
        startActivityForResult(intent, 1);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1 && requestCode == RESULT_OK) {
            tvMainSupplier.setText(data.getStringExtra("supplier"));
        }
    }
}